/**
 * @fileOverview
 * @author wangshaojun
 * @version
 */

import React, {
    PropTypes,
    Component,
} from 'react';

import {
    ActivityIndicator,
    View,
} from 'react-native';

export default class ListViewActivityIndicator extends Component {

    static defaultProps = {
        color: '#ccc',
        size: 'small',
        visible: 'visible',
    }

    static propTypes = {
        ...View.PropTypes,
        color: PropTypes.string,
        visible: PropTypes.string,
        size: PropTypes.oneOf(['small', 'large']),
    }

    constructor(props) {
        super(props)
        this.state = {
            visible: this.props.visible == 'visible'? true:false,
        }
    }

    render() {
        if(this.state.visible) {
            return (
                <ActivityIndicator
                    {...this.props}
                    animating={true} />
            )
        }
        else {
            return null;
        }
    }

}
